package v3.chapter1.t8;

public class Run {

	public static void main(String[] args) {
		MyThread mythread=new MyThread();
		System.out.println("begin ="+System.currentTimeMillis());
		mythread.run();
		System.out.println("end ="+System.currentTimeMillis());
		
		MyThread mythread2=new MyThread();
		System.out.println("begin ="+System.currentTimeMillis());
		mythread2.start();
		System.out.println("end ="+System.currentTimeMillis());
	}

}

class MyThread extends Thread{

	@Override
	public void run() {
		try {
			System.out.println("run threadName="+this.currentThread().getName()+" begin");
			Thread.sleep(2000);
			System.out.println("run threadName="+this.currentThread().getName()+" end");
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}
}

class MyThread2 extends Thread{

	@Override
	public void run() {
		try { 
			System.out.println("run threadName="+this.currentThread().getName()+" begin ="+System.currentTimeMillis());
			Thread.sleep(2000);
			System.out.println("run threadName="+this.currentThread().getName()+" end ="+System.currentTimeMillis());
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}
}